package evq.codec.core.entities;

import java.util.Set;
import java.util.SortedMap;
import java.util.SortedSet;
import java.util.TreeMap;
import java.util.TreeSet;

public class Dictionary {

	private SortedMap<Integer, Vector> vectorsMap = new TreeMap<Integer, Vector>();
	private int quantizatorDimension;
	private int size;

	public Dictionary() {
	
	}
	
	public Dictionary(int quantizatorDimension, int size) {
		super();
		this.quantizatorDimension = quantizatorDimension;
		this.size = size;
	}

	public void addVector(Integer code, Vector vector) {
		this.vectorsMap.put(code, vector);
	}
	
	public Vector getVector(Integer code) {
		return this.vectorsMap.get(code);
	}
	
	public Set<Integer> getCodes() {
		SortedSet<Integer> codes = new TreeSet<Integer>();
		
		for (Integer code : this.vectorsMap.keySet()) {
			codes.add(code);
		}
		
		return codes;
	}

	public int getQuantizatorDimension() {
		return quantizatorDimension;
	}

	public void setQuantizatorDimension(int quantizatorDimension) {
		this.quantizatorDimension = quantizatorDimension;
	}

	public int getSize() {
		return size;
	}

	public void setSize(int size) {
		this.size = size;
	}
	
}
